package cn.group.controller;

import cn.group.service.PieChartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import pojo.qo.BrowserTotal;
import utils.BaseController;

import javax.servlet.http.HttpServletResponse;

@Api(tags = "饼状图")
@Controller
@RequestMapping(value = "/pieChart",produces = "text/html;charset=UTF-8")
public class PieChartController extends BaseController {
    @Autowired
    private PieChartService pieChartService;

    @ApiOperation("展示浏览器数据")
    @RequestMapping(value = "showBrowser.do")
    @ResponseBody
    public String showBrowser(HttpServletResponse resp){
      BrowserTotal browserTotal= pieChartService.showBrowserMessage();
      if (null==browserTotal){
          String errorMsg="数据错误";
        return   writerErrorResult(errorMsg,resp);
      }
     return writerSuccessResult(browserTotal,resp);
    }
}
